<template>
  <view>
    <u-popup mode="center" :show="show" title="提示" :round="radius">
      <view class="modal_wrap">
        <view class="modal_title">提示</view>
        <view class="modal_content">
          <slot>
            {{ content }}
          </slot>
        </view>
        <view class="modal_buttons">
          <view class="button cancel" v-if="showCancel" @click="cancel">{{ cancelText }}</view>
          <view class="button confirm" @click="confirm">{{ confirmText }}</view>
        </view>
      </view>
    </u-popup>
  </view>
</template>

<script>
export default {
  props: {
    show: {
      type: Boolean,
      default: false
    },
    content: {
      type: String,
      default: ''
    },
    showCancel: {
      type: Boolean,
      default: false
    },
    radius: {
      type: [String, Number],
      default: 8
    },
    cancelText: {
      type: String,
      default: '取消'
    },
    confirmText: {
      type: String,
      default: '确认'
    }
  },
  data() {
    return {

    }
  },
  methods: {
    cancel() {
      this.$emit('cancel')
    },
    confirm() {
      this.$emit('confirm')
    }
  }
}
</script>

<style scoped lang="scss">
  .modal_wrap {
    width: 60vw;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 8px;
  }

  .modal_title {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
  }
  .modal_content {
    margin: 15px 0;
    text-align: center;
  }

  .modal_buttons {
    display: flex;
    align-items: center;

    .button {
      width: 100%;
      padding: 8px 10px;
      margin: 10px 10px 5px;
      border-radius: 8px;
      font-size: 14px;
      text-align: center;
      font-weight: bold;
    }

    .confirm {
      background-color: $primary-theme-color;
      color: #ffffff;
    }

    .cancel {
      background-color: rgba($color: $primary-theme-color, $alpha: .2);
      color: $primary-theme-color;
    }
  }
</style>